﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

public partial class FAQforUSER : System.Web.UI.Page
{
    string strConnect;
    SqlConnection con;
    SqlCommand cmd;
    SqlDataAdapter da;
    DataSet ds;
    protected void Page_Load(object sender, EventArgs e)
    {
        strConnect = "Data Source = (local); Database =photofpt; User id = sa; Password = 30041975";
        con = new SqlConnection(strConnect);
        ds = new DataSet();
        if (!IsPostBack)
            BindFAQ();
    }

    protected void BindFAQ()
    {
        try
        {
            if (con.State == ConnectionState.Closed)
                con.Open();
            cmd = new SqlCommand("getFAQ", con);
            cmd.CommandType = CommandType.StoredProcedure;
            da = new SqlDataAdapter(cmd);
            da.Fill(ds, "FAQ");
            GridView1.DataSource = ds.Tables[0];
            GridView1.DataBind();


        }
        catch (SqlException ex)
        {
            //throw new Exception(ex.Message);
        }
        finally
        {
            con.Close();
        }
    }
}